package com.java.array;

import java.util.Scanner;

public class ArrayDemo5 {

    public static void main(String[] args) {
        //二维数组保存成绩
        int[][] scores = new int[3][5];
        //输入成绩
        Scanner scanner = new Scanner(System.in);
        //总平均成绩
        int sum = 0;
        //循环进行输入
        for (int i = 0; i < scores.length; i++) {
            //班级总成绩
            int classScore = 0;
            System.out.println("第" + (i + 1) + "个班的成绩：");
            for(int j = 0;j < scores[i].length;j++){
                System.out.println("第" + (j + 1) + "个同学成绩：");
                scores[i][j] = scanner.nextInt();
                //累加学生成绩到班级成绩中
                classScore += scores[i][j];
            }
            //计算平均成绩
            int avgScore = classScore / scores[i].length;
            System.out.println("第" + (i + 1) + "个班的平均成绩：" + avgScore);
            //加班级平均成绩
            sum += avgScore;
        }
        System.out.println("总平均成绩是：" + sum / scores.length);
    }
}
